package com.jiangyg.mall.member.service;

import com.jiangyg.mall.core.support.restful.Pagination;
import com.jiangyg.mall.db.mybatis.BaseServiceImpl;
import com.jiangyg.mall.member.dao.MemberStatisticsInfoDao;
import com.jiangyg.mall.member.dto.MemberStatisticsInfoDTO;
import com.jiangyg.mall.member.entity.MemberStatisticsInfo;
import com.jiangyg.mall.member.vo.MemberStatisticsInfoVO;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class MemberStatisticsInfoServiceImpl extends BaseServiceImpl<MemberStatisticsInfoDao, MemberStatisticsInfo> implements MemberStatisticsInfoService {

    @Autowired
    public MemberStatisticsInfoServiceImpl(MemberStatisticsInfoDao memberStatisticsInfoDao) {
        super(memberStatisticsInfoDao);
    }

    @Override
    @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
    public Pagination<MemberStatisticsInfoVO> selectPagination(Pagination<MemberStatisticsInfoVO> pagination) throws Exception {
        return this.executeSelectPagination(pagination, MemberStatisticsInfoVO.class);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean saveOrUpdate(MemberStatisticsInfoDTO dto) throws Exception {
        return this.executeSaveOrUpdate(dto) > 0;
    }

    @Override
    @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
    public MemberStatisticsInfoVO selectById(Long memberStatisticsInfoId) throws Exception {
        return this.executeSelectById(memberStatisticsInfoId, MemberStatisticsInfoVO.class);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean delete(List<Long> memberStatisticsInfoIds) {
        return this.baseMapper.deleteBatchIds(memberStatisticsInfoIds) > 0;
    }

}
